<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('考勤详情列表')" />
</head>
<body class="gray-bg">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>姓名：</label>
                                <input type="text" name="userName"/>
                            </li>
                            <li>
                                <label>用户类别：</label>
                                <select name="userType" th:with="type=${@dict.getType('basic_user_type')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>工资类型：</label>
                                <select name="salaryType" id="salaryType" class="form-control">
                                    <option value="">全部</option>
                                    <option value="1">在职职工</option>
                                    <option value="2">退休职工</option>
                                    <option value="3">铁路退休职工</option>
                                    <option value="4">临时工</option>
                                </select>
                            </li>
                            <li>
                                <label>职位类别：</label>
                                <select name="userPosition" th:with="type=${@dict.getType('basic_user_position')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>技术类别：</label>
                                <select name="technicalType" th:with="type=${@dict.getType('basic_user_technical')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>编制情况：</label>
                                <select name="workDuty" th:with="type=${@dict.getType('basic_work_duty')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>聘任职称等级：</label>
                                <select name="postLevel" th:with="type=${@dict.getType('basic_post_level')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>聘任岗位级别：</label>
                                <select name="appointLevel" th:with="type=${@dict.getType('appoint_level')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>工资薪级：</label>
                                <select name="salaryLevel" th:with="type=${@dict.getType('salary_level')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>是否默认：</label>
                                <select name="isDefault" th:with="type=${@dict.getType('sys_yes_no')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:selected="${dict.dictValue == 'Y'}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="record:wage:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="record:wage:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="record:wage:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="record:wage:import">
                    <i class="fa fa-upload"></i> 导入
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: bootstrap-table-export-js" />
    <script th:inline="javascript">
        var prefix = ctx + "record/wage";

        var positions = [[${@dict.getType('basic_user_position')}]];
        var technicals = [[${@dict.getType('basic_user_technical')}]];
        var workDutys = [[${@dict.getType('basic_work_duty')}]];
        var postLevelDatas = [[${@dict.getType('basic_post_level')}]];
        var appointLevelDatas = [[${@dict.getType('appoint_level')}]];
        var salaryLevelDatas = [[${@dict.getType('salary_level')}]];
        var defaultDatas = [[${@dict.getType('sys_yes_no')}]];

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                importUrl: prefix + "/importData",
                importTemplateUrl: prefix + "/importTemplate",
                modalName: "档案工资",
                showExport: true,
                exportTypes: ['sql', 'excel'], // 导出的文件类型
                exportOptions: {
                    fileName: '档案工资',    // 文件名称设置
                    mso: {
                        worksheetName: '档案工资',
                        //修复导出数字不显示为科学计数法
                        onMsoNumberFormat: function (cell, row, col) {
                            return !isNaN($(cell).text())?'\\@':'';
                        }
                    }
                },
                columns: [{
                    checkbox: true,
                    printIgnore: true
                },
                {
                    field: 'wageId',
                    title: '工资id',
                    visible: false
                },
                {
                    field: 'userName',
                    title: '用户姓名',
                    sortable: true
                },
                {
                    field: 'idCard',
                    title: '身份证号',
                    sortable: true
                },
                {
                    field: 'salaryType',
                    title: '工资类型',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if(value == '1') {
                            return '在职职工';
                        }else if(value == '2') {
                            return '退休职工';
                        }else if(value == '3') {
                            return '铁路退休';
                        }else if(value == '4') {
                            return '临时工';
                        }
                    }
                },
                {
                    field: 'userPosition',
                    title: '职位类别',
                    sortable: true,
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(positions, value);
                    }
                },
                {
                    field: 'technicalType',
                    title: '技术类别',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(technicals, value);
                    }
                },
                {
                    field: 'workDuty',
                    title: '编制情况',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(workDutys, value);
                    }
                },
                {
                    field: 'postLevel',
                    title: '职称聘任等级',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(postLevelDatas, value);
                    }
                },
                {
                    field: 'appointLevel',
                    title: '聘任岗位级别',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(appointLevelDatas, value);
                    }
                },
                {
                    field: 'salaryLevel',
                    title: '工资薪级',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(salaryLevelDatas, value);
                    }
                },
                {
                    field: 'a0',
                    title: '岗位工资'
                },
                {
                    field: 'a1',
                    title: '薪级工资'
                },
                {
                    field: 'a2',
                    title: '教护工资'
                },
                {
                    field: 'a3',
                    title: '基础绩效'
                },
                {
                    field: 'a4',
                    title: '基础绩效奖'
                },
                {
                    field: 'a5',
                    title: '物业'
                },
                {
                    field: 'a6',
                    title: '房贴'
                },
                {
                    field: 'a7',
                    title: '奖励性绩效'
                },
                {
                    field: 'wageTime',
                    title: '执行时间'
                },
                {
                    field: 'isDefault',
                    title: '是否默认',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(defaultDatas, value);
                    }
                },
                {
                    field: 'remark',
                    title: '备注'
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
<!-- 导入区域 -->
<script id="importTpl" type="text/template">
    <form enctype="multipart/form-data" class="mt20 mb10">
        <div class="col-xs-offset-1">
            <input type="file" id="file" name="file"/>
            <div class="mt10 pt5">
                <input type="checkbox" id="updateSupport" name="updateSupport" title="如果人员工资已经存在，更新这条数据。"> 是否更新已经存在的档案工资
                &nbsp;	<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
            </div>
            <font color="red" class="pull-left mt10">
                提示：仅允许导入“xls”或“xlsx”格式文件！
            </font>
        </div>
    </form>
</script>
</html>